<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

class Module_management extends MX_Controller {

	public function __construct() {
		parent::__construct();
		$this->load->model(array('admin_settings_model','admin_module_model'));
		
// 		/$this->admin_commoncall->check_admin_login();
		$this->template->set_theme('admin');
		$this->template->set_layout('default');	
		
		
	}
	
	function index()
	{
		$status=51;
		$featured=false;
		$search = "";
		
		if($this->input->post('filter')){
			$filter = $this->input->post('filter');
		
			switch ($filter) {
				case 'active':
					$status = 51;
					break;
				case 'inactive':
					$status = 0;
					break;
				case 'featured':
					$status = 51;
					$featured=true;
					break;
			}
		}
		
		$data['modules'] = $this->admin_module_model->get_modules($status = $status);
		
		$this->template->title('Welcome', 'Ypage.com')
		->set_partial('nav_bar','layouts/nav_bar')
		->set_partial('side_menu','layouts/side_menu')
		->build('module/modules',$data);
	
	}
	
	function change_module_status($status=NULL,$id=NULL) {
		$this->admin_module_model->change_status($id,$status);
		redirect('secure/module/module_management');
	}
	
}